#include "Evenement.h"

std::string Evenement :: touchePossible;

Evenement :: Evenement()
{
    Evenement :: init();
    Evenement::touchePossible = "zdsqeva";
}

Evenement :: ~Evenement()
{
    endwin();
}

int Evenement :: event()
{
    int toucheEntree = getch();
    for(unsigned int i = 0; i < (Evenement::touchePossible).length(); i++)
    {
        if( toucheEntree == (Evenement::touchePossible)[i] )
        {
            return i;
        }
        else if(toucheEntree==27)
            return -2;
    }
    return -1;
}

void Evenement :: setTouchePossible(std :: string str)
{
    Evenement :: touchePossible = str;
}

void Evenement :: init()
{

    initscr();
    refresh();
    cbreak();
    noecho();
}

void Evenement :: end()
{
    endwin();
}
std::string Evenement::getTouchePossible()
{
    return touchePossible;

}
char Evenement::getHaut()
{
    return touchePossible[0];
}
char Evenement::getBas()
{
    return touchePossible[2];
}
